package com.qf.shop.controller;

import com.qf.shop.annotation.ProcessInfo;
import com.qf.shop.entity.items;
import com.qf.shop.service.IItemsService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin(origins = "*")
@RequestMapping("/Items")
public class ItemsController {

    private IItemsService itemsServiceImpl;

    public ItemsController(IItemsService itemsServiceImpl) {
        this.itemsServiceImpl = itemsServiceImpl;
    }

    @GetMapping
    @ProcessInfo("获取商品的类目")
    public List<items> getAllItems(){
        List<items> allItems = itemsServiceImpl.getAllItems();
        return allItems;
    }

}
